package com.emeraldparser.util;

public abstract class AbstractAutomaton<V, E> extends AbstractGraph<V, E> implements Automaton<V, E> {

	@Override
	public boolean addStartVertex(V startVertex) {
		return getStartVertices().add(startVertex);
	}

	@Override
	public boolean addAcceptVertex(V acceptVertex) {
		return getAcceptVertices().add(acceptVertex);
	}

	@Override
	public boolean addRejectVertex(V rejectVertex) {
		return getRejectVertices().add(rejectVertex);
	}

	@Override
	public boolean addAll(Automaton<? extends V, ? extends E> automaton) {
		// TODO Auto-generated method stub
		boolean modified = false;
		modified |= ((Graph<V, E>) this).addAll(automaton);
		modified |= getStartVertices().addAll(automaton.getStartVertices());
		modified |= getAcceptVertices().addAll(automaton.getAcceptVertices());
		modified |= getRejectVertices().addAll(automaton.getRejectVertices());
		return modified;
	}

	@Override
	public boolean addGraph(Graph<? extends V, ? extends E> graph) {
		// TODO Auto-generated method stub
		return addAll(graph);
	}

}
